home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * BEDIT.H Header file for Turbo C TOOLS Field Editing Functions
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1988
- *
- **/
-
-
- #ifndef DEF_BEDIT /* Prevent second reading of */
- #define DEF_BEDIT 1 /* these definitions. */
-
- #include <bkeybrd.h>
- #include <bscreens.h>
- #include <bwindow.h>
-
-
- /********************************************************************/
- /* Definitions of data types. */
- /********************************************************************/
-
- typedef enum /* ED_ACTION: */
- { /* values for the EDIT_KEY */
- /* action field. */
- ED_NULL, /* No action. */
- ED_ABORT, /* Quit with no edit. */
- ED_BEEP, /* Sound the system speaker. */
- ED_ATTR, /* Alter attributes. */
- ED_ASCII, /* Display the character. */
- ED_LEFT, /* Move left. */
- ED_RIGHT, /* Move right. */
- ED_UP, /* Move up one line. */
- ED_DOWN, /* Move down one line. */
- ED_FRONT, /* Move to front of buffer. */
- ED_END, /* Move to end of buffer. */
- ED_TEXT_END, /* Move to last non-whitesp. */
- ED_WRAP, /* Word wrap the buffer. */
- ED_REDUCE, /* Reduce whitespace. */
- ED_NEXT_WORD, /* Move to next word. */
- ED_PREV_WORD, /* Move to previous word. */
- ED_BEGIN_WORD, /* Move to start of word. */
- ED_END_WORD, /* Move to end of word. */
- ED_NEXT_WHITE, /* Move to next/previous */
- ED_PREV_WHITE, /* whitespace character. */
- ED_NEXT_NONWHITE, /* Move to next/previous non-*/
- ED_PREV_NONWHITE, /* whitespace character. */
- ED_DELETE, /* Delete current character. */
- ED_RUBOUT, /* Move left and delete char.*/
- ED_DELLEFT, /* Delete char to left. */
- ED_DEL_WORD, /* Delete a word. */
- ED_CLEAR, /* Clear the entire buffer. */
- ED_CLEAREOL, /* Clear to end of line. */
- ED_CLEAREOB, /* Clear to end of buffer. */
- ED_INSERT, /* Insert mode. */
- ED_REPLACE, /* Replace (not insert) mode.*/
- ED_INSTOGGLE, /* Toggle insert mode. */
- ED_UNDO, /* Recover previous buffer. */
- ED_TRANSMIT, /* Finish edit. */
- ED_INVALID_ACTION /* Invalid edit action. */
- } ED_ACTION;
-
-
- typedef struct
- { /* ED_ACTION_LIST structure: */
- int num_actions; /* number of action codes, */
- ED_ACTION *pactions; /* array of action codes. */
- } ED_ACTION_LIST;
-
-
- typedef struct
- { /* ED_KEY structure: */
- ED_ACTION_LIST edit_actions; /* edit actions, key */
- KEY_SEQUENCE key_sequence; /* sequence and attribute */
- int attribute; /* for edit key. */
- } ED_KEY;
-
-
- typedef struct ed_list /* ED_LIST structure: */
- { /* ED_KEY & pointers to */
- ED_KEY edit_key; /* next and last items in */
- struct ed_list *pnext; /* edit key list. */
- struct ed_list *pprev;
- } ED_LIST;
-
-
- typedef struct /* ED_BUFFER structure: */
- { /* edit buffer passed to */
- /* edbuffer(). */
- char *pbuffer; /* Edit buffer. */
- DIM dimensions; /* Dimensions of field. */
- int attribute; /* Display attributes. */
- int buffer_size; /* Maximum length of buffer. */
- int cursor_pos; /* Edit position in buffer. */
- int data_end; /* End of data in buffer. */
- unsigned int control_flags; /* Flags for edbuffer/edbase.*/
- } ED_BUFFER;
-
-
- typedef struct /* ED_CONTROL structure: */
- { /* position & info for an */
- /* edit buffer. */
- LOC ul_corner; /* Upper left corner. */
- DIM dimensions; /* Dimensions of field. */
- int attribute; /* Display attributes. */
- CUR_TYPE replace_cursor; /* Cursor size for replace */
- CUR_TYPE insert_cursor; /* and insert modes. */
- PKEY_CONTROL control_function; /* Key control function. */
- unsigned int control_flags; /* edfield() control flags. */
- } ED_CONTROL;
-
-
- typedef struct
- {
- int action_code; /* Single action code. */
- KEY_SEQUENCE key_sequence; /* Key sequence for edit key.*/
- } ED_DEF_KEY;
-
-
- typedef int cdecl (*PED_RET_FUNC)(void *, CUR_INFO *, const LOC *,
- int, int);
- typedef int cdecl (*PED_SET_FUNC)(void *, int, CUR_TYPE *, int, int);
- typedef void cdecl (*PED_WRITE_FUNC)(void *, int, int, int, int,
- const char *, int, int, int);
-
-
- /********************************************************************/
- /* User Macros. */
- /********************************************************************/
-
- #define edfield(pinitstr,pretstr,target_size,pfield_control,pfinal) \
- (edbase(NIL, (pinitstr), (pretstr), (target_size), \
- (pfield_control), (pfinal), edretinf, edsetcur, \
- edwrrect))
-
- /* Edit mode constants for control_flags member of */
- /* the ED_CONTROL structure. */
- #define ED_LEFTJUST 0x8000 /* Left justify upon exit. */
- #define ED_CENTERJUST 0x4000 /* Center justify upon exit. */
- #define ED_RIGHTJUST 0x2000 /* Right justify upon exit. */
- #define ED_ZERO_FILL 0x1000 /* Zero fill. */
- #define ED_BEEP_END 0x0800 /* Beep when at end of field.*/
- #define ED_AUTOSKIP 0x0400 /* Transmit at end of field. */
- #define ED_INSERT_MODE 0x0200 /* Start in INSERT mode. */
- #define ED_WORD_WRAP 0x0100 /* Word wrap buffer. */
-
-
-
- /********************************************************************/
- /* Global variables */
- /********************************************************************/
-
- extern ED_LIST *b_pkey_root; /* Edit key list head. */
- extern int b_pkeys_init; /* Non-zero if edit key list */
- /* has been initialized. */
-
- extern ED_DEF_KEY b_defkeys[]; /* Default edit key records. */
-
-
-
- /********************************************************************/
- /* Error codes. */
- /********************************************************************/
-
- #define ED_NO_ERROR WN_NO_ERROR
- #define ED_NO_MEMORY WN_NO_MEMORY
- #define ED_ILL_DIM WN_ILL_DIM
- #define ED_NO_KEY 300
- #define ED_KEY_EXISTS 301
- #define ED_USER_ABORT 302
-
-
- /********************************************************************/
- /* User function declarations. */
- /********************************************************************/
-
- int cdecl edinitky(void); /* Initialize edit key list. */
- /* */
- ED_KEY *cdecl edretkey(const /* Return an edit key record from */
- KEY_SEQUENCE *); /* the edit key list. */
- /* */
- int cdecl edchgkey( /* Change an edit key record in */
- const /* the edit list. */
- KEY_SEQUENCE *, /* the edit list. */
- const /* */
- ED_ACTION_LIST *);/* */
- /* */
- int cdecl edremkey(const /* Delete an edit key record in */
- KEY_SEQUENCE *); /* the edit list. */
- /* */
- void cdecl edzapkey(void); /* Release the entire edit list. */
- /* */
- ED_ACTION cdecl edbuffer( /* Edit a buffer. */
- ED_BUFFER *, /* */
- const ED_KEY *); /* */
- /* */
-
- /********************************************************************/
- /* Internal function declarations. */
- /********************************************************************/
-
- int cdecl edretinf(void *, CUR_INFO *, const LOC *, int, int);
- int cdecl edsetcur(void *, int, CUR_TYPE *, int, int);
- void cdecl edwrrect(void *, int, int, int, int, const char *,
- int, int, int);
- int cdecl edbase(void *, const char *, char *, int,
- const ED_CONTROL *, KEY_SEQUENCE *, PED_RET_FUNC,
- PED_SET_FUNC, PED_WRITE_FUNC);
- void cdecl edwrap(ED_BUFFER *);
- void cdecl edreduce(ED_BUFFER *);
-
-
- #endif /* Ends "#ifndef DEF_BEDIT" */